package com.tao.controller;

import com.tao.entity.UserEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Map;

@Controller
public class MythymeleafController {
    @RequestMapping("/myThymeleaf")
    public String myThymeLeaf(HttpServletRequest request, Map<String,Object> result){
//        request.setAttribute("user",new UserEntity("taozi",19));
        result.put("user",new UserEntity("taozi",19));

        ArrayList<UserEntity>  userEnties = new ArrayList<>();
        userEnties.add(new UserEntity("taozi1",21));
        userEnties.add(new UserEntity("taozi2",22));
        userEnties.add(new UserEntity("taozi3",23));
        result.put("userList",userEnties);

        return "myThymeleaf";
    }
}
